package com.cdvtc.forum_system.service.Impl;

import com.cdvtc.forum_system.dao.Impl.UserDaoImpl;
import com.cdvtc.forum_system.dao.UserDao;
import com.cdvtc.forum_system.model.User;
import com.cdvtc.forum_system.service.UserService;

import java.util.List;
import java.util.logging.Logger;

public class UserServiceImpl implements UserService {
    private static final Logger logger = Logger.getLogger("com.cdvtc.forum_system");

    private UserDao userDao = new UserDaoImpl();

    @Override
    public User login(String user_account, String user_password) {
        logger.info("账户【"+user_account+"】登陆...");
        return userDao.login(user_account, user_password);
    }

    @Override
    public User getUserById(int user_id) {return userDao.getUserById(user_id);}


    @Override
    public boolean addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public boolean isUserExisted(String key, String value) {
        return userDao.isUserExisted(key, value);
    }

    @Override
    public List<User> getAllUsers() {
        return userDao.getAllUsers();
    }

    @Override
    public void forbiddenUser(int userId, boolean forbidden) {userDao.forbiddenUser(userId, forbidden);}

    @Override
    public void forgetPassword(String user_account, String user_nickname) {
        userDao.forgetPassword(user_account, user_nickname);
    }

    @Override
    public void updateUser(User user) {
        userDao.updateUser(user);
    }
}

